﻿/*
 * GET home page.
 */
import {ExpressExt} from "../expressExt/ExpressExt";
import {NullPara} from "../modReq/NullPara";
import {Index} from "../views/Index";
import {TestFile} from "../modReq/TestFile";

export = (http:ExpressExt) => {

    http.get("/", NullPara, async(req, resp) => {
        let a = {a: "aa\ta\r\n"}

        return Index.home(req, JSON.stringify(a));
    });


    http.post("/test/upload", TestFile, async(req, resp, dat) => dat);

    http.get("/test/form", null, async(req, resp) => {
        return `
<form action="/test/upload" enctype="multipart/form-data" method="post">
<input type="text" name="title[0][asss]"><br>
<input type="text" name="title[1][ssss]"><br>
<input type="file" name="upload[]" multiple="multiple"><br>
<input type="file" name="upload[]" multiple="multiple"><br>
<input type="file" name="upload2" multiple="multiple"><br>
<input type="submit" value="Upload">
</form>`
    });
}
